package org.example.servicemanage.config;


import com.auth0.jwt.algorithms.Algorithm;
import jakarta.annotation.PostConstruct;
import org.example.servicemanage.utils.JwtUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component

public class YmlConfig {
    @Value("${jwt.secret}")
    public static String JWT_SECRET;

    @Value("${jwt.expireTime}")
    public static long JWT_EXPIRE_TIME;

    @Value("${wx.appid}")
    public static String WX_APPID;

    @Value("${wx.secret}")
    public static String WX_SECRET;

    public static String WX_GRANT_TYPE = "client_credential";

    public static String WX_TOKEN;

    @PostConstruct
    public void init() {
        JwtUtil.SECRET = JWT_SECRET;
        JwtUtil.EXPIRE_TIME = JWT_EXPIRE_TIME;
        JwtUtil.ALGORITHM = Algorithm.HMAC256(JwtUtil.SECRET);
    }
}
